﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MINERP.DAL;

using MINERP.MODEL.Statistics;
using MINERP.DAL.Statistics;

namespace MINERP.BLL.Statistics
{
    public class BackOrderBLL
    {
        private DAL.Statistics.BackOrderDAL DSB = new BackOrderDAL();

        #region 获取指定商户所有冲印类产品
        /// <summary>
        /// 获取指定商户所有冲印类产品
        /// </summary>
        /// <returns></returns>
        public List<BackOrderEntity.ProductCL> GetProductList(int shopId)
        {
            try
            {
                List<BackOrderEntity.ProductCL> ListProduct = new List<BackOrderEntity.ProductCL>();
                List<Tb_Product> query = DSB.GetProduct(shopId);
                foreach (Tb_Product product in query)
                {
                    BackOrderEntity.ProductCL p = new BackOrderEntity.ProductCL();
                    p.ProductId = product.ProuctId;
                    p.ProductName = product.ProductName;
                    ListProduct.Add(p);
                }
                return ListProduct;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        #endregion

        #region 获取由商户ID与产品Id确定的纸型、纸面、面积单价
        /// <summary>
        /// 获取由商户ID与产品Id确定的纸型、纸面、面积单价
        /// </summary>
        /// <param name="shopId"></param>
        /// <param name="productId"></param>
        /// <returns></returns>
        public List<string> GetPaperTypeAndPaperFace(int shopId, int productId)
        {
            try
            {
                List<string> list=DSB.GetPaperTypeAndPaperFace(shopId, productId);
                return list;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        #endregion

        #region 开退单
        /// <summary>
        /// 开退单
        /// </summary>
        public void BackOrder(int billId, int productId, int shopId, double height, double width, double unitPrice, string ctmName, int pageNum, string pName, string remark)
        {
            try
            {
                int status = (int)COM.OrderInfoStatus.Completed;
                DSB.BackOrder(billId, productId, shopId, height, width, unitPrice, ctmName, pageNum, pName, status, remark);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        #endregion
    }
}
